package de.lns.entities.turrets;

import java.nio.FloatBuffer;

import de.lns.entities.ai.HomingBulletai;
import de.lns.entities.effect.Damage;
import de.lns.entities.effect.Damageeffect;
import de.lns.entities.effect.InstantDamageEffect;
import de.lns.entities.effect.ModifierEffect;
import de.lns.entities.mobs.Mob;
import de.lns.entities.mobs.Modification;
import de.lns.level.Level;
import de.lns.render.ModelFactory;

public class PhysicalShot extends Bullet {

	private static double radius = 10;
	private static String texturepath="entities/BulletPhysical.png";
	private static FloatBuffer mesh=ModelFactory.genRectMesh((float)radius*2, (float)radius*2);
	private static int textureid;
	static{
		textureid = de.lns.render.TextureLoader.loadTexture(texturepath);
	}
	
	public PhysicalShot(double posX, double posY, Mob target) {
		super(posX, posY, target);
		setSpeed(500);
        ai = new HomingBulletai(this);
	}
	@Override
	public FloatBuffer getMesh(){
		return mesh;
	}
	    
	public int getTextureID(){
	    	return textureid;
	}
	@Override
	public void onCollision(Mob mob) {
		mob.addEffect(new InstantDamageEffect(mob, Damage.physical, 15, 20));
		mob.addEffect(new ModifierEffect(mob, 1000, Modification.physical, ModifierEffect.flat, 5));
		Level.removeEntity(this);		
	}
}
